package me.zk.practice1.s;

public class LS1004 {
    public int longestOnes(int[] nums, int k) {

        int max  =0;
        int left = 0;
        int zeroTatal = 0;
        for (int r = 0; r < nums.length; r++) {
           if (nums[r] == 0) {
               zeroTatal++;
           }
            while (zeroTatal > k) {
                if (nums[left] == 0) {
                    zeroTatal--;
                }
                left++;
            }
            max = Math.max(max,r-left+1);

        }
        return max;
    }
}
